home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
4.2
/
arexx
/
editor
/
fixproject.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-04-16
|
5KB
|
208 lines
/* FixProject.rexx V4.0 -- Fixes a project... And it works! Honest!!! */
/* By Bob Caron (Grue) ©1995 NewTek Inc. */
/* (This program was Re-Created at the last minute..) */
call remlib('ToasterARexx.port')
call remlib(PROJECT_REXX_PORT)
call addlib('PROJECT_REXX_PORT',0)
call addlib('ToasterARexx.port',0)
call set_view(2)
call req_error("Fix Project V4.0 --- Automate replacing missing croutons.")
project_end=croutonsinproject()
badcroutons=0;paths=0
current_spot=0;found=0
done=0 ; smart=0;buttons='00'
do while done=0
buttons=req_buttons("Choose Level:",buttons,"Standard","Semi-Automatic")
if buttons="CANCEL" then return CANCEL
if substr(buttons,1,1)="1" then do
done=1
end
if substr(buttons,2,1)="1" then do
smart=1; done=1
end
end
do count=0 to project_end-1
if crnumtype(count)="ERR!" then do
badcroutons=badcroutons+1
missing.badcroutons=crnumgettag(count,OriginalLocation)
location.badcroutons=count
end
end
if smart=0 then call FixCroutonsDumb()
if smart=1 then call FixCroutonsSmart()
call writetags()
if found=0 then call req_error("All Done... No 'missing' croutons found.")
else call req_error("All Done... Save fixed project under a new name.")
drive="toaster:projects/"
file="FixedProject"
num=1
do while exists(drive||file||num||".Prj")
num=num+1
end
projname=file||num||".Prj"
if found>0 then do
rx startfilereq("Save Project Where?",drive,projname)
exit=1
do while exit=1
file=queryfilereq()
if file=0 then call quit
if file~="" then exit=0
address command "c:wait 1"
end
doit=1
if exists(file) then
if req_tell("Replace existing project?")=0 then doit=0
if doit=1 then do
call PROJECTSAVE(file)
call req_error("Saved...")
end
end
call remlib("PROJECT_REXX_PORT")
call remlib('ToasterARexx.port')
exit
/* Sub Routines. */
fixCroutonsDumb:
do count=1 to badcroutons
if ~exists(missing.count) then do
status=fixcrouton(count)
if status=0 then count=count-1
end
end
return
exit
fixCroutonsSmart:
do count=1 to badcroutons
if ~exists(missing.count) then do
call choppath(missing.count)
status=0
do pcount=1 to paths
path=spaths.pcount
if right(path,1)=":" then name=path||filenam
else name=path||"/"||filenam
if exists(name) then do
call req_error("Auto-Replacing Crouton:"||name)
missing.count=name
found=found+1
status=1
end
end
if status=0 then
status=fixcrouton(count)
if status=0 then count=count-1
end
end
return
fixcrouton:
parse arg current
call choppath(missing.current)
call req_error("Please locate:"||missing.current)
call startfilereq("Locate Crouton ["||missing.current||"]",path,filenam)
exit=1
do while exit=1
file=queryfilereq()
if file=0 then do
if req_tell("Do you want to quit?")=1 then call quit
return 0
end
if file~="" then exit=0
address command "c:wait 1"
end
call choppath(file)
call pragma("D",path)
path=pragma("D","RAM:")
if right(path,1)=":" then name=path||filenam
else name=path||"/"||filenam
if exists(name) then do
temp=missing.current
missing.current=name
do count2=current to badcroutons
if missing.count2=temp then do
missing.count2=missing.current
call req_error("Auto-Replacing Crouton:"||missing.current)
end
end
found=found+1
dont=0
if smart=1 then do
if paths=0 then do
spaths.1=path
paths=1
return 1
end
do pcount=1 to paths
if spaths.pcount=path then
dont=1
end
if dont=0 then do
paths=paths+1
spaths.paths=path
end
end
end
if ~exists(name) then
return 0
return 1
quit:
call writetags()
call req_error("")
call remlib("PROJECT_REXX_PORT")
call remlib('ToasterARexx.port')
exit
choppath:
parse arg file
if lastpos('/',file,length(file)-1)~=0 then do
filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
path=left(file,(lastpos('/',file,length(file))-1))
end
else do
filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
path=left(file,(lastpos(':',file,length(file))))
end
return
writetags:
do count=1 to badcroutons
call CRNUMSETTAG(location.count,'OriginalLocation',missing.count)
end
return